#include <cstdio>
#include <vector>
constexpr int MaxN = 2e3 + 5;
int n, m;
std::vector<int> g[MaxN];
void solve()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++)
    {
        g[i].clear();
    }
    for (int i = 1; i <= m; i++)
    {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back(v);
        g[v].push_back(u);
    }
    printf("%d 998244352\n", -(m + 1));
}
int main()
{
    freopen("oi.in", "r", stdin);
    freopen("oi.out", "w", stdout);
    int c, t;
    scanf("%d%d", &c, &t);
    for (int i = 1; i <= t; i++)
    {
        solve();
    }
    return 0;
}
